#include <REGX52.H>
#include <intrins.h>

sbit scl = P0^1;
sbit sda = P0^3;

void Delay100ms()		//@11.0592MHz
{
	unsigned char i, j;

	i = 180;
	j = 73;
	do
	{
		while (--j);
	} while (--i);
}




void IIC_START(){
	
	scl = 1;
	sda = 0;
	_nop_();
	sda = 1;
	_nop_();
	sda = 0;
	_nop_();
	scl = 0;
}

void IIC_STOP(){
	
	scl = 0;
	sda = 0;
	_nop_();
	scl = 1;
	_nop_();
	sda = 1;
	_nop_();
	sda = 0;
}

void ICC_ACK(){

	char flag;
	sda = 1;
	_nop_();
	scl = 1;
	_nop_();
	flag= sda;
	_nop_();
	scl = 0;
}

void ICC_send_Btye(char datasend){

	int i = 0;
	
	for(i = 0;i < 8;i++){
		scl = 0;
		sda = datasend & 0x80;
		_nop_();
		scl = 1;
		_nop_();
		scl = 0;
		_nop_();
		datasend <<= 1;
	}
	sda = 1; //数据发送完毕，释放数据线
}

void mian(){

	;
}